package com.xnew.user.controller;

import com.xnew.bean.common.SysUserInfo;
import com.xnew.user.service.UserInfoService;
import com.xnew.utils.DataInput;
import com.xnew.utils.DataOutput;
import com.xnew.utils.MybatisParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/user")
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;

    /**
     * 人员列表查询
     * */
    @RequestMapping(value = "/queryUserInfoList", method = RequestMethod.POST)
    @ResponseBody
    public DataOutput queryUserInfoList(@RequestBody DataInput input){
        DataOutput out = DataOutput.success();
        try{
            List<SysUserInfo> list = userInfoService.selectUserList(input);
            out = MybatisParam.getOutput(list);
            out.setMsg("人员列表查询成功");
        }catch (Exception e){
            out.setCode(-80098);
            out.setMsg("人员列表查询失败");
        }
        return out;
    }

}
